package LatentTicTacToe.InformationSets;

import java.io.Serializable;
import java.util.LinkedList;

import LatentTicTacToe.Data.Move;

public class InformationSet implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Player making decision in this set
	 */
	public byte currentPlayer = 0;

	/**
	 * Probability that this set will be reached
	 */
	private float probability = 0;

	/**
	 * Array holding values of available moves
	 */
	public float[] values;

	/**
	 * Available moves
	 */
	public LinkedList<Move> moves;

	/**
	 * Value of winner in this set, zero if not terminal
	 */
	public byte winner = 0;

	public InformationSet() {

	}

	public InformationSet(LinkedList<Move> moves, byte currentPlayer, byte winner) {

		this.moves = new LinkedList<Move>();

		if (moves != null)
			this.moves.addAll(moves);
		
		this.values = new float[moves.size()];
		this.currentPlayer = currentPlayer;
		this.winner = winner;
	}

	public void setProbability(float probability) {
		this.probability = probability;
	}

	public float getProbability() {
		return probability;
	}
	
	
	public void clearValues() {
		values = new float[moves.size()];
	}
}
